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,EACAe,UAAWlB,EAAOmB,WAAW,EAG/B,MACE,GAAAC,EAAAC,IAAA,EAACC,UAAAA,WACC,GAAAF,EAAAG,GAAA,EAACC,EAAAA,CAAIA,CAAAA,CACHX,MAAOb,EAAOK,IAAI,CAClBc,YAAa,wBAAoCM,MAAA,CAAZzB,EAAOK,IAAI,CAAC,8DAEnD,GAAAe,EAAAG,GAAA,EAAC/B,EAAAA,CACCQ,OAAQW,EACRe,SAAUzB,MAAAA,EAAAA,KAAAA,EAAAA,EAAOyB,QAAQ,CACzBC,QAAS,CACPC,gBAAiB,CACff,MAAO,eAA2BY,MAAA,CAAZzB,EAAOK,IAAI,CACnC,CACF,MAIR","sources":["webpack://_N_E/?9e09","webpack://_N_E/./src/pages/author/[slug].tsx","webpack://_N_E/"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/author/[slug]\",\n function () {\n return require(\"private-next-pages/author/[slug].tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/author/[slug]\"])\n });\n }\n ","import { IAuthor } from '@/components/templates/AuthorBioTemplate/AuthorBioTemplate';\nimport Head from '@/components/templates/Head/Head';\nimport { GetServerSidePropsContext, InferGetServerSidePropsType } from 'next';\n\nimport { contentful } from '@/component-library-lib/dataSource/contentful/client';\nimport { Topics } from '@/component-library-lib/dataSource/contentful/models/topics';\nimport { ICardArticle } from '@/components/molecules/CardArticle/CardArticle';\nimport { ISocialLinkItem } from '@/components/molecules/SocialLinks/SocialLinks';\nimport { addHttps } from '@/lib/utils/stringReplace/addHttps';\nimport { ArticleProps } from '@/pages/articles/[slug]';\nimport dynamic from 'next/dynamic';\n\nconst AuthorBioTemplate = dynamic(\n import('@/components/templates/AuthorBioTemplate/AuthorBioTemplate')\n);\n\n/** The props for the Custom Page */\nexport type AuthorProps = InferGetServerSidePropsType<\n typeof getServerSideProps\n>;\n\n/** The info for the Author */\ntype AuthorInfo = {\n /** The name of the author */\n name: string;\n /** The position of the author */\n position?: string;\n /** The image url of the author */\n imageUrl: string;\n /** The social links of the author */\n socialLinks: ISocialLinkItem[];\n /** The bio of the author */\n biography: string;\n};\n\n/**\n * A page for the Author\n *\n * @param {AuthorProps} props - The props for the page\n * @returns {React.FC} Page\n */\nconst Author = (props: AuthorProps) => {\n const author = props.fields;\n const socialLinks: ISocialLinkItem[] = [];\n if (author.socialTwitter) {\n socialLinks.push({\n name: 'Visit my profile on Twitter',\n icon: 'twitter',\n url: author.socialTwitter,\n });\n }\n\n if (author.socialFacebook) {\n socialLinks.push({\n name: 'Visit my profile on Facebook',\n icon: 'facebook',\n url: author.socialFacebook,\n });\n }\n if (author.socialLinkedin) {\n socialLinks.push({\n name: 'Visit my profile on LinkedIn',\n icon: 'linkedIn',\n url: author.socialLinkedin,\n });\n }\n if (author.socialInstagram) {\n socialLinks.push({\n name: 'Visit my profile on instagram',\n icon: 'instagram',\n url: author.socialInstagram,\n });\n }\n\n const authorObject: AuthorInfo = {\n name: author.name,\n position: author?.title,\n imageUrl: addHttps(author.image?.fields?.file?.url),\n socialLinks,\n biography: author.description,\n };\n\n return (\n
\n \n \n
\n );\n};\n\nexport default Author;\n\n/**\n * @param {object} context - The context object\n * @returns {object} - The props object\n */\nexport const getServerSideProps = async (\n context: GetServerSidePropsContext<{\n /** The locale */\n locale?: string;\n /** The slug */\n slug: string;\n }>\n) => {\n const data = await contentful.withoutUnresolvableLinks.getEntries<\n Topics['Author']\n >({\n content_type: 'author',\n 'fields.slugs': context.params?.slug,\n locale: 'en-US',\n include: 10,\n });\n\n if (data?.items?.length === 0) {\n return {\n notFound: true,\n };\n }\n\n const articles = await contentful.withoutUnresolvableLinks.getEntries<\n Topics['Article']\n >({\n content_type: 'article',\n skip: 0,\n limit: 3,\n locale: 'en-US',\n include: 10,\n ...(data.items[0].fields.slugs && {\n 'fields.author.fields.slugs': data.items[0].fields.slugs,\n 'fields.author.sys.contentType.sys.id': 'author',\n }),\n });\n\n /**\n * Fixing circular reference error: The data structure of the article contains\n * references to the `acrossArticleCards` that in turn contains references to\n * the `acrossArticleCards` and so on. This was creating a circular reference\n * between the items, which can lead to unexpected behavior and memory leaks.\n * To fix the issue, we are assigning `null` to the `acrossArticleCards`\n * property of each item in the array, if the array exists. This breaks the\n * circular reference and prevents any potential issues.\n */\n if (\n articles?.items?.length > 0 &&\n articles?.items[0]?.fields.acrossArticleCards\n ) {\n articles.items[0].fields.acrossArticleCards.forEach((item) => {\n if (item) {\n item.fields.acrossArticleCards = [];\n }\n });\n }\n\n const articlesData = articles\n ? articles.items.map((article: ArticleProps) => {\n return {\n title: article.fields.title,\n excerpt: article.fields.excerpt,\n image: addHttps(article.fields.featuredImage?.fields?.file?.url),\n url: `/articles/${article.fields.slugs}`,\n };\n })\n : null;\n\n return {\n notFound: !data.items.length,\n props: {\n ...data.items[0],\n articles: articlesData,\n },\n };\n};\n"],"names":["window","__NEXT_P","push","__webpack_require__","AuthorBioTemplate","dynamic","Promise","all","e","then","bind","__webpack_exports__","author","props","fields","socialLinks","socialTwitter","name","icon","url","socialFacebook","socialLinkedin","socialInstagram","authorObject","position","title","imageUrl","addHttps","image","file","biography","description","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsxs","section","jsx","Head","concat","articles","content","articlesDisplay"],"sourceRoot":""}